package com.java.learning.demo.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.java.learning.demo.entity.Student;
import com.java.learning.demo.mapper.StudentMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class StudentService {
    private StudentMapper studentMapper;

    public void saveStudent(Student t) {
        studentMapper.insert(t);
    }
    public Student getStudent(String stuNo){
        QueryWrapper<Student> studentQueryWrapper = new QueryWrapper<>();
        //根据手机号查询用户信息
        studentQueryWrapper.lambda().eq(Student::getStuNo, stuNo);
        //检查用户是否存在
        return studentMapper.selectOne(studentQueryWrapper);

    }

}
